/*
 * Copyright 2008-2015 GuanAiHui inc. 
 */
package com.pretty.adminapp.pojo.model.um;

import com.pretty.adminapp.pojo.base.AutoIdBaseEntity;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * RolePrivilege:
 *
 * @author Dennis Ge
 */
@Entity
@Table(name = "um_role_permission")
@DynamicInsert
@DynamicUpdate
public class RolePermission extends AutoIdBaseEntity {

	@Column(name = "role_id")
	private Long roleId;

	@Column(name = "permission_id")
	private Long permissionId;

	@ManyToOne
	@JoinColumn(name = "permission_id", insertable = false, updatable = false)
	private Permission permission;

	public Long getRoleId() {
		return roleId;
	}

	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}

	public Long getPermissionId() {
		return permissionId;
	}

	public void setPermissionId(Long permissionId) {
		this.permissionId = permissionId;
	}

	public Permission getPermission() {
		return permission;
	}

	@Override
	public String toString() {
		return "RolePermission [roleId=" + roleId + ", permissionId=" + permissionId + "]";
	}

}
